package com.example.demo.mapper;

import com.example.demo.entity.maintenance;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface maintenanceMapper {
    @Select("select * from view_maintenance order by wticketkey desc limit 1")
    public maintenance last();

    @Insert("insert into view_maintenance(rgrade,rcategory,wticketkey,raction,fkey,robject,rdate,nextrdate,maintainer" +
            ") value(#{rgrade},#{rcategory},#{wticketkey},#{raction},#{fkey},#{robject}," +
            "#{rdate},#{nextrdate},#{maintainer})")
    public int insert(maintenance maintenance);

    @Select("select * from view_maintenance where fkey=#{fkey}")
    public maintenance selectfkey(int fkey);

    @Select("select * from view_maintenance")
    public List<maintenance> query();
}
